package com.yunhai.device.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunhai.common.dto.PaginationVo;
import com.yunhai.common.dto.Ret;
import com.yunhai.device.service.OrrDeviceOperatorStatusService;
import com.yunhai.model.entity.orr.OrrDeviceOperatorStatusEntity;
import com.yunhai.model.vo.orr.OrrDeviceOperatorStatusQuery;
import com.yunhai.model.vo.orr.OrrDeviceOperatorStatusVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/orrDeviceOperatorStatus")
public class OrrDeviceOperatorStatusController {

	@Resource
	private OrrDeviceOperatorStatusService orrDeviceOperatorStatusService;


	/**
	 * 获取 OrrDeviceOperatorStatus 分页列表
	 */
	@GetMapping("/pagination")
	public Ret getOrrDeviceOperatorStatusPagination(PaginationVo paginationVo, OrrDeviceOperatorStatusQuery orrDeviceOperatorStatusQuery ) throws Exception {
		IPage page = orrDeviceOperatorStatusService.getOrrDeviceOperatorStatusPagination(paginationVo, orrDeviceOperatorStatusQuery );
		return Ret.toPage(page);
	}


	/**
	 * 获取 OrrDeviceOperatorStatus 所有数据
	 */
	@GetMapping("/allList")
	public Ret getOrrDeviceOperatorStatusAllList( OrrDeviceOperatorStatusQuery orrDeviceOperatorStatusQuery ) throws Exception {
		List<OrrDeviceOperatorStatusEntity> list = orrDeviceOperatorStatusService.getOrrDeviceOperatorStatusAllList( orrDeviceOperatorStatusQuery );
		return Ret.ok(list);
	}


	/**
	 * 获取 OrrDeviceOperatorStatus 详情
	 */
	@GetMapping("/{id}")
	public Ret getOrrDeviceOperatorStatusDetailById(@PathVariable Long id) throws Exception {

	    OrrDeviceOperatorStatusEntity orrDeviceOperatorStatusEntity = orrDeviceOperatorStatusService.getOrrDeviceOperatorStatusDetail(id);
		return Ret.ok(orrDeviceOperatorStatusEntity);
	}


	/**
	 * 新增 OrrDeviceOperatorStatus
	 * */
	@PostMapping("")
	public Ret addOrrDeviceOperatorStatus(@RequestBody OrrDeviceOperatorStatusVo orrDeviceOperatorStatusVo) throws Exception {

		orrDeviceOperatorStatusService.addOrrDeviceOperatorStatus(orrDeviceOperatorStatusVo);
		return Ret.ok();
	}


	/**
	 * 更新 OrrDeviceOperatorStatus
	 * */
	@PutMapping("")
	public Ret updateOrrDeviceOperatorStatus(@RequestBody OrrDeviceOperatorStatusVo orrDeviceOperatorStatusVo) throws Exception {

		orrDeviceOperatorStatusService.updateOrrDeviceOperatorStatus(orrDeviceOperatorStatusVo);
		return Ret.ok();
	}


	/**
	 * 删除 OrrDeviceOperatorStatus
	 * */
	@PostMapping("/batchRemove")
	public Ret batchRemoveOrrDeviceOperatorStatus( @RequestBody List<Long> ids ) throws Exception {

	    orrDeviceOperatorStatusService.batchRemoveOrrDeviceOperatorStatus(ids);
		return Ret.ok();
	}
}
